package com.ton.system.service;

import com.kypj.frame.db.MyTemplate;
import com.ton.system.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService {

    @Autowired
    private MyTemplate myTemplate;


    /**
     * 根据用户名查询用户
     * @param name
     * @return
     */
    public User getUserByName(String name){
        System.out.println(112121);
        return myTemplate.myGetObjectAppendWhere(User.class, "name = ?", name);
    }

    /**
     * 保存用户 user
     * @param user 用户对象
     * @return 返回布尔
     */
    public boolean saveUser(User user){
        myTemplate.mySaveObject(user);
        return true;
    }

}
